﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Apq.Win
{
    /// <summary>
    /// 全局对象
    /// </summary>
    public static class GlobalObject
    {
        #region TheAssembly
        private static System.Reflection.Assembly _TheAssembly;
        /// <summary>
        /// 该程序集配置文件(程序集名.后缀.xml)
        /// </summary>
        public static System.Reflection.Assembly TheAssembly
        {
            get
            {
                if (_TheAssembly == null)
                {
                    _TheAssembly = System.Reflection.Assembly.GetExecutingAssembly();
                }
                return _TheAssembly;
            }
        }
        #endregion

        #region XmlAsmConfig
        private static Apq.Config.XmlConfig _XmlAsmConfig;
        /// <summary>
        /// 该程序集配置文件(程序集名.后缀.apq)
        /// </summary>
        public static Apq.Config.XmlConfig XmlAsmConfig
        {
            get
            {
                if (_XmlAsmConfig == null)
                {
                    _XmlAsmConfig = Apq.Config.ApqConfigs.GetAsmConfig(TheAssembly) as Apq.Config.XmlConfig;
                }
                return _XmlAsmConfig;
            }
        }
        #endregion

        #region XmlUserConfig
        private static Apq.Config.XmlConfig _XmlUserConfig;
        /// <summary>
        /// 该程序集用户配置文件(程序集名.后缀.apq)
        /// </summary>
        public static Apq.Config.XmlConfig XmlUserConfig
        {
            get
            {
                if (_XmlUserConfig == null)
                {
                    _XmlUserConfig = Apq.Config.ApqConfigs.GetUserConfig(TheAssembly) as Apq.Config.XmlConfig;
                }
                return _XmlUserConfig;
            }
        }
        #endregion

        #region XmlConfigChain
        private static Apq.Config.ConfigChain _XmlConfigChain;
        /// <summary>
        /// 该程序集配置文件链
        /// </summary>
        public static Apq.Config.ConfigChain XmlConfigChain
        {
            get
            {
                if (_XmlConfigChain == null)
                {
                    _XmlConfigChain = new Apq.Config.ConfigChain(XmlAsmConfig, XmlUserConfig);
                }
                return _XmlConfigChain;
            }
        }
        #endregion
    }
}
